package com.swmutil.swmutil;

import com.swmutil.swmutil.util.MenuUtils;
import com.swmutil.swmutil.util.StaParas;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

import java.io.IOException;

public class HomeApplication extends Application {

    @Override
    public void start(Stage stage) throws IOException {

        VBox vBox = new VBox();
        //添加菜单栏
        MenuUtils.buildMenu();
        vBox.getChildren().add(StaParas.menuBar);
        //添加界面
        FXMLLoader fxmlLoader = new FXMLLoader(HomeApplication.class.getResource("home.fxml"));
        // 为表格设置控制器
        fxmlLoader.setController(StaParas.masterController);
        vBox.getChildren().add(fxmlLoader.load());

        Scene scene = new Scene(vBox, 1700, 825);
        scene.getStylesheets().add("custom.css"); // 指定CSS文件

        stage.setScene(scene);
        stage.show();
        StaParas.masterController.loadPageMenu();
    }
    public static void main(String[] args) {
        launch();
    }
}